import React, { useEffect, useState } from 'react';
import { Form, Button, message, Input } from 'antd';
import CommonModal from '@/components/CommonModal';
import CommonLoading from '@/components/CommonLoading';

const { TextArea } = Input;

const RefuseModal = ({ visible, handleCancel, recordData }) => {
  const [form] = Form.useForm();
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    if (visible) {
      form.resetFields();
    }
  }, [visible]);

  const onCancel = () => {
    handleCancel();
  };

  return (
    <CommonModal
      title="审核拒绝"
      visible={visible}
      onCancel={onCancel}
      footer={[
        <Button onClick={handleCancel} key="onOk">
          确定
        </Button>,
      ]}
    >
      <Form
        form={form}
        initialValues={{
          remark: recordData?.remark,
        }}
        name="audit-reject-modal-form"
      >
        <Form.Item
          name="remark"
          label="备注"
          rules={[{ required: true, message: '请输入备注' }]}
        >
          <TextArea disabled={true} rows={6} placeholder="请输入备注" />
        </Form.Item>
      </Form>
      <CommonLoading loading={loading} />
    </CommonModal>
  );
};

export default RefuseModal;
